package com.hrbxlh.virtualization.dto;

import com.hrbxlh.virtualization.vo.ImageVO;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.beans.BeanUtils;

/**
 * @author cheer
 */
public class ImageDTO {

    private Long id;

    private String imageName;

    private Boolean initial;

    private String userName;

    public ImageVO convertToImageVO() {
        ImageVO imageVO = new ImageVO();
        BeanUtils.copyProperties(this, imageVO);
        imageVO.setName(imageName);
        if (initial) {
            imageVO.setImageSource("预置");
        } else {
            imageVO.setImageSource(userName);
        }
        return imageVO;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getImageName() {
        return imageName;
    }

    public void setImageName(String imageName) {
        this.imageName = imageName;
    }

    public Boolean getInitial() {
        return initial;
    }

    public void setInitial(Boolean initial) {
        this.initial = initial;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("id", id)
                .append("imageName", imageName)
                .append("initial", initial)
                .append("userName", userName)
                .toString();
    }
}
